package org.dormi.learn.pojo;

import org.dormi.learn.utils.JsonSerializer;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * @author : dormi330
 * @version : 1.0
 */
public class ExtensibleTenantPO extends BasePO {

    private String extJson;
    private Long tenantId;
    private Integer version;
    private LocalDateTime createdTime;
    private LocalDateTime updatedTime;
    private Long createdBy;
    private Long updatedBy;
    private String remark;
    private Integer enabled;

    /** 设置初始值 */
    public void defaultValueForNewPO() {
        LocalDateTime now = LocalDateTime.now();
        setVersion(1);
        setEnabled(1);
        setCreatedTime(now);
        setUpdatedTime(now);
    }

    /** 将 extJson 解析成 map */
    public Map<String, String> jsonToMap() {
        if (extJson == null) {
            return null;
        }
        return (Map<String, String>) JsonSerializer.jsonToObj(extJson, Map.class);
    }

    /* === set/get === */
    /* === set/get === */
    /* === set/get === */

    public String getExtJson() {
        return extJson;
    }

    public void setExtJson(String extJson) {
        this.extJson = extJson;
    }

    public Long getTenantId() {
        return tenantId;
    }

    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }

    public LocalDateTime getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(LocalDateTime updatedTime) {
        this.updatedTime = updatedTime;
    }

    public Long getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(Long createdBy) {
        this.createdBy = createdBy;
    }

    public Long getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(Long updatedBy) {
        this.updatedBy = updatedBy;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getEnabled() {
        return enabled;
    }

    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }
}
